const triggerHashChange = () => {
  window.location.hash = 'hashChange'
}
const triggerPushState = () => {
  window.history.pushState({ foo: 'foo1' }, 'page 2', '/pushstate.html')
}
const triggerReplaceState = () => {
  window.history.replaceState({ foo: 'foo1' }, 'page 2', '/replaceState.html')
}
const triggerSendPageview = () => {
  window.SdkClient('sendPageview', 'sendPageview')
}

const triggerPerformanceInit = () => {
  window.SdkClient('performanceInit')
}

const triggerPerformanceSend = () => {
  window.SdkClient('performanceSend')
}

const triggerPushStateWithHash = () => {
  window.history.pushState({ foo: 'foo1' }, 'page 2', '/pushstate.html#push-state-hash')
}

export const TriggerPageview = () => {
  return (
    <>
      <button id="trigger-hash-change" onClick={triggerHashChange}>
        trigger-hash-change
      </button>
      <button id="trigger-push-state-with-hash" onClick={triggerPushStateWithHash}>
        trigger-push-state-with-hash
      </button>
      <button id="trigger-push-state" onClick={triggerPushState}>
        trigger-push-state
      </button>
      <button id="trigger-replace-state" onClick={triggerReplaceState}>
        trigger-replace-state
      </button>
      <button id="trigger-send-pageview" onClick={triggerSendPageview}>
        trigger-send-pageview
      </button>
      <button id="trigger-performance-init" onClick={triggerPerformanceInit}>
        trigger-performance-init
      </button>
      <button id="trigger-performance-send" onClick={triggerPerformanceSend}>
        trigger-performance-send
      </button>
    </>
  )
}
